package cc.magicjson.minigame.demo.ddd.infrastructure.event;

import cc.magicjson.minigame.demo.ddd.domain.event.DomainEvent;
import cc.magicjson.minigame.demo.ddd.domain.event.DomainEventPublisher;
import org.springframework.context.ApplicationEventPublisher;
import org.springframework.stereotype.Component;

@Component
public class AntiCorruptionDomainEventPublisher implements DomainEventPublisher {
	private final ApplicationEventPublisher applicationEventPublisher;

	public AntiCorruptionDomainEventPublisher(ApplicationEventPublisher applicationEventPublisher) {
		this.applicationEventPublisher = applicationEventPublisher;
	}

	@Override
	public void publish(DomainEvent event) {
		applicationEventPublisher.publishEvent(event);
	}

	// 移除了 registerListener 方法，因为我们现在使用 @EventListener 注解
}